﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace Entities
{
    /// <summary>
    /// 项目表
    /// </summary>
    [SugarTable("project", TableDescription = "项目表")]
    public class ProjectEntity
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id", ColumnDescription = "主键ID")]
        public long Id { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        [SugarColumn(ColumnName = "name", ColumnDescription = "项目名称")]
        public string Name { get; set; }

        /// <summary>
        /// 项目周期-开始日期
        /// </summary>
        [SugarColumn(ColumnName = "begindate", ColumnDescription = "项目周期-开始日期")]
        public DateTime BeginDate { get; set; }

        /// <summary>
        /// 项目周期-结束日期
        /// </summary>
        [SugarColumn(ColumnName = "enddate", ColumnDescription = "项目周期-结束日期")]
        public DateTime EndDate { get; set; }

        /// <summary>
        /// 项目负责人
        /// </summary>
        [SugarColumn(ColumnName = "uid", ColumnDescription = "项目负责人")]
        public long UId { get; set; }

        /// <summary>
        /// 项目负责人-对象信息
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public UserEntity User { get; set; }

        /// <summary>
        /// 项目涉及人员
        /// </summary>
        [SugarColumn(ColumnName = "uids", ColumnDataType = "json", IsJson = true, ColumnDescription = "项目涉及人员")]
        public List<long> UIds { get; set; } = new();

        /// <summary>
        /// 项目涉及人员-集合对象信息
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<UserEntity> Users { get; set; } = new();

        /// <summary>
        /// 是否是活动数据 1.是 0.否
        /// </summary>
        [SugarColumn(ColumnName = "isactive", ColumnDescription = "是否是活动数据 1.是 0.否")]
        public int IsActive { get; set; } = 1;

        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "created", IsOnlyIgnoreUpdate = true, DefaultValue = "CURRENT_TIMESTAMP")]
        public DateTime Created { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>        
        [SugarColumn(ColumnName = "updated", DefaultValue = "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")]
        public DateTime Updated { get; set; }
    }
}
